﻿@model OrderModel


<div class="layui-card">
    <div class="layui-card-body">
        <div class="layui-form" wid100 lay-filter="">
            <div class="layui-form-item">
                <input asp-for="Id" type="hidden" />
                <div class="col-md-3">
                    <u-label asp-for="OrderSubtotalValue" />
                </div>
                <div class="layui-input-inline">
                    <u-editor asp-for="OrderSubtotalValue" />
                </div>
            </div>
            <div class="layui-form-item">
                <div class="col-md-3">
                    <u-label asp-for="OrderShippingValue" />
                </div>
                <div class="layui-input-inline">
                    <u-editor asp-for="OrderShippingValue" />
                </div>
            </div>
            <div class="layui-form-item">
                <div class="col-md-3">
                    <u-label asp-for="PaymentMethodAdditionalFeeValue" />
                </div>
                <div class="layui-input-inline">
                    <u-editor asp-for="PaymentMethodAdditionalFeeValue" />
                </div>
            </div>
            <div class="layui-form-item">
                <div class="col-md-3">
                    <u-label asp-for="OrderTotalValue" />
                </div>
                <div class="layui-input-inline">
                    <u-editor asp-for="OrderTotalValue" />
                </div>
            </div>
            <div class="layui-form-item" style="display:none;">
                <div class="layui-input-block">
                    <button class="layui-btn" id="set_system_submit_btn" lay-submit lay-filter="set_system_submit_btn">确认保存</button>
                </div>
            </div>
        </div>
    </div>

    <script>
        layui.use(['index'], function () {
        var $ = layui.$
            , form = layui.form
            ,active = { }
            form.on('submit(set_system_submit_btn)', function (obj) {
                var index = layer.load(2, { shade: false });
                var field = obj.field; //获取提交的字段
                //layer.msg(JSON.stringify(obj.field));
                //提交 Ajax 成功后，关闭当前弹层并重载表格
                $.post('@Url.Action("EditOrderTotal",new { id=Model.Id})', field, function (rep) {
                    if (rep.success == 1) {
                        layer.close(index);
                        layer.msg("保存成功,即将自动关闭", { time: 2 * 1000 }, function () {
                            var iframe_index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            console.log("当前iframe层的索引:" + iframe_index + "==window.name:" + window.name);
                            parent.layer.close(iframe_index); //再执行关闭
                            window.parent.location.reload();
                        });
                    }

                });
                return false;
        });
        $('.layui-btn.layuiadmin-btn-tags').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
    </script>
</div>
